package com.blank.web.servlet;

import com.blank.web.service.StudentService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "delStudentServlet",urlPatterns = "/delStudent")
public class delStudentServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //接受学生要删除的sid值
       int sid = Integer.parseInt(request.getParameter("sid"));
        StudentService studentService = new StudentService();
        studentService.Delete(sid);
        System.out.println("删除成功！");
        request.getRequestDispatcher("showStuInfo").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
